/**************************************************************
 * lyricparse.h - for parsing .lrc lyric file
 * Copyright (c) 2009  Qin Xiaoxue  <crs.chin@gmail.com>
 *
 * This file is  free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * 
**************************************************************/


/*
 *application interface definitions for lyric file parsing.
 *currently,ONLY SIMPLE LYRIC FILE FORMAT IS SUPPORTED.
 *
 *                                                 --by Q
 */

#ifndef __LYRICPARSE_H
#define __LYRICPARSE_H

#define LIB_VERSION "0.2"

struct lyric;

typedef struct lyric lyric_t;

lyric_t *lyricparse_parse_lyric(FILE *fp);
lyric_t *lyricparse_parse_lyric_file(char *path);

/* NOTE: time unit is millisecond */
int lyricparse_get_lyric(lyric_t *l, char **text, int *begin, int *end, int now);
int lyricparse_get_begintime(lyric_t *lyricdata);


int lyricparse_save_lyric(lyric_t *lyricdata,FILE *fp);
int lyricparse_save_lyric_file(lyric_t *lyricdata,char *path);

int lyricparse_save_as_srt(lyric_t *lyricdata,FILE *fp);
int lyricparse_save_as_srt_file(lyric_t *lyricdata,char *path);


const char *lyricparse_get_title(lyric_t *lyricdata);
const char *lyricparse_get_artist(lyric_t *lyricdata);
const char *lyricparse_get_album(lyric_t *lyricdata);
const char *lyricparse_get_author(lyric_t *lyricdata);

const char *lyricparse_get_editor(lyric_t *lyricdata);
const char *lyricparse_get_producer(lyric_t *lyricdata);
const char *lyricparse_get_version(lyric_t *lyricdata);

void lyricparse_set_title(lyric_t *lyricdata, const char *title);
void lyricparse_set_artist(lyric_t *lyricdata, const char *artist);
void lyricparse_set_album(lyric_t *lyricdata, const char *album);
void lyricparse_set_author(lyric_t *lyricdata, const char *author);

void lyricparse_set_editor(lyric_t *lyricdata, const char *editor);
void lyricparse_set_producer(lyric_t *lyricdata, const char *producer);
void lyricparse_set_version(lyric_t *lyricdata, const char *version);

void lyricparse_release_lyric(lyric_t *lyricdata);

/*
 *write meta info to mp3 audio files in
 *FIXME: umimplemented!
 **/
int lyricparse_write_meta_info(lyric_t *lyricdata,char *path);
int lyricparse_write_meta_info_file(lyric_t *lyricdata,FILE *fp);


#define MAX_TAGLEN 35

#endif  /*__LYRICPARSE_H*/
